package com.client.service.impl;

import com.Emplyment.util.AliPay;
import com.Emplyment.vo.PayResultVo;
import com.client.mapper.MemberCenterMapper;
import com.client.service.MenberCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MenberCenterServiceImpl implements MenberCenterService {

    @Autowired
    private MemberCenterMapper memberCenterMapper;

    /**
     * 升级会员
     * @param username
     * @param amount
     * @return
     */
    @Override
    public AliPay aliPay(String username, double amount) {
        AliPay aliPay = new AliPay();
        aliPay.setOut_trade_no(username);
        aliPay.setSubject("用户升级会员");
        aliPay.setTotal_amount(amount);
        aliPay.setBody(username+"升级会员");
        return aliPay;
    }

    @Override
    public void updataPayStatus(PayResultVo payResultVo) {
        memberCenterMapper.updataPayStatus(payResultVo);
    }

    @Override
    public Integer getMenberInfo(String username) {
        Integer count = memberCenterMapper.getMenberInfo(username);
        return count;
    }
}
